package leetcode.code0793;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int preimageSizeFZF(int k) {
		long l = 0, r = Long.MAX_VALUE;
		while (l <= r) {
			long mid = ((r - l) >> 1) + l;
			long sum5 = 0 , cnt = mid;
			while (cnt >= 5) {
				sum5 += cnt / 5;
				cnt /= 5;
			}
			if (sum5 == k) {
				return 5;
			} else if (sum5 > k) {
				r = mid - 1;
			} else {
				l = mid + 1;
			}
		}
		return 0;
	}

	@Override
	public void debug4() {
		this.preimageSizeFZF(3);

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
